# -*- coding:utf-8 -*-

from django.db import models
from bsddb.test.test_all import verbose
from django.conf import settings
from django_thumbs.db.models import ImageWithThumbsField


class Trainings (models.Model):
    title = models.CharField(max_length=100, verbose_name=u'标题')
    GROUP_TRAINING = 0
    OUTDOOR_TRAINING = 1
    MODE = (
            (GROUP_TRAINING, u'团体授课'),
             (OUTDOOR_TRAINING,u'室外授课'),
              )
    start_at = models.DateField()
    location = models.CharField(max_length=255, verbose_name=u'地点')
    lessons_number = models.IntegerField()
    total_count = models.IntegerField()
    sell_count = models.IntegerField()
    availabe_cnt = models.IntegerField()
    price = models.IntegerField()
    avatar_url = ImageWithThumbsField(upload_to=settings.TRAININGS_AVATAR, 
                                      default=settings.TRAININGS_AVATAR_DEFAULT)

    class Meta:
        verbose_name=u'训练'
        verbose_name_plural = verbose_name